package kr.hkit.androidcomplete01.ch07;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class PaintStyle extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(new MyView(this));
	}

	class MyView extends View {
		
		private Paint paint;

		public MyView(Context context) {
			super(context);
			paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		}
		
		
		@Override
		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			
			canvas.drawColor(Color.LTGRAY);
			
			paint.setStrokeWidth(8);
			paint.setColor(Color.RED);
			
			//채우기
			paint.setStyle(Paint.Style.FILL);
			canvas.drawCircle(50, 50, 40, paint);
			
			//외곽선 그리기
			paint.setStyle(Paint.Style.STROKE);
			canvas.drawCircle(150, 50, 40, paint);
			
			//외곽선 및 채우기
			paint.setStyle(Paint.Style.FILL_AND_STROKE);
			canvas.drawCircle(250, 50, 40, paint);
			
			//파란색으로 채우고 빨간색으로 외곽선 그리기
			paint.setColor(Color.BLUE);
			paint.setStyle(Paint.Style.FILL);
			canvas.drawCircle(50, 150, 40, paint);
			paint.setColor(Color.RED);
			paint.setStyle(Paint.Style.STROKE);
			canvas.drawCircle(50, 150, 40, paint); //같은 위치에 빨간 선 그리기
			
			//빨간색으로 외곽선 그리고 파란색 채우기 
			paint.setColor(Color.RED);
			paint.setStyle(Paint.Style.STROKE);
			canvas.drawCircle(150, 150, 40, paint);
			paint.setColor(Color.BLUE);
			paint.setStyle(Paint.Style.FILL);
			canvas.drawCircle(150, 150, 40, paint);
			
			//304page
		}
		
	}
}
